package com.liusand.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.liusand.web.mapper.CategoryMapper;
import com.liusand.web.service.CategoryService;
import com.liusand.xo.pojo.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author LiuSha
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public List<Category> findAll() {
        LambdaQueryWrapper<Category> w = new LambdaQueryWrapper<>();
        w.isNull(Category::getDeleted);
        w.orderByDesc(Category::getCreated);
        return categoryMapper.selectList(w);
    }
}
